<template>
  <view @click="emit('update:count', 99)">{{ count }}</view>
</template>

<script setup lang="ts">
  // npm run dev:h5
  /*
  interface Props {
    msg: number
  }
  const fn = () => {
    alert('子组件' + props.msg)
    props.msg + 1
  }

  const props = defineProps<Props>()
  console.log('props  ----->  ', props.msg)
*/

  // vue3中v-model的变化

  // Vue2
  // v-model => :value  @input

  // Vue3中 v-model可以带参数
  // v-model => :modelValue  @update:modelValue
  // v-model:xxx => :xxx  @update:xxx

  interface Props {
    count: number
  }

  defineProps<Props>()
  interface Emits {
    (name: 'update:count', newCount: number): void
  }
  const emit = defineEmits<Emits>()
</script>

<style lang="scss" scoped></style>
